<script>
export default {
  onLaunch: function() {
    console.log('App Launch')

    const that = this
    uni.getSystemInfo({
      success: function(e) {
        let navHeight = e.statusBarHeight
        // #ifndef MP
        if (e.platform === 'android') {
          navHeight = e.statusBarHeight + 50
        } else {
          navHeight = e.statusBarHeight + 45
        }
        // #endif

        // #ifdef MP-WEIXIN

        // 获取胶囊按钮的布局位置信息，坐标信息以屏幕左上角为原点
        const custom = wx.getMenuButtonBoundingClientRect()

        // 导航栏高度 = 状态栏到胶囊的间距（胶囊距上距离-状态栏高度） * 2 + 胶囊高度 + 状态栏高度。

        navHeight = custom.height + (custom.top - e.statusBarHeight) * 2 + e.statusBarHeight
        const navTop = custom.top
        const capsuleHeight = custom.height
        // #endif

        // #ifdef MP-ALIPAY
        navHeight = e.statusBarHeight + e.titleBarHeight
        // #endif
        uni.setStorageSync('navHeight', navHeight)
        // #ifdef MP-WEIXIN
        uni.setStorageSync('navTop', navTop)
        uni.setStorageSync('capsuleHeight', capsuleHeight)
        // #endif
      }
    })
   
  },
  onShow: function() {
    console.log('App Show')
  },
  onHide: function() {
    console.log('App Hide')
  },
  methods: {
   
  }
}
</script>

<style>
/* 解决头条小程序组件内引入字体不生效的问题 */
/* #ifdef MP-TOUTIAO */

@font-face {
	font-family: uniicons;
	src: url('/static/uni.ttf');
}
/* #endif */
</style>
